Change name of named boundary
The below code snippet shows how to change name of named boundary. The code changes name of first named boundary from the collection.
//Required References using System; using System.Diagnostics; using Bentley.DgnPlatformNET; using Bentley.MstnPlatformNET; public void ChangeNamedBoundaryName() { try { //Get active DGN DgnModelRef dgnModelRef = Session.Instance.GetActiveDgnModelRef(); DgnFile dgnFile = dgnModelRef.GetDgnFile(); //Get all models ModelIndexCollection modelIndexCollection = dgnFile.GetModelIndexCollection(); foreach (ModelIndex modelIndex in modelIndexCollection) { DgnModel dgnModel = dgnFile.LoadRootModelById(out StatusInt status, modelIndex.Id); //Get Named Boundary Collection from current DgnModel NamedBoundaryCollection namedBoundaries = new NamedBoundaryCollection(dgnModel); //Iterate the Named Boundary Collection foreach (NamedBoundary namedBoundary in namedBoundaries) { //Change name of first named boundary from collection namedBoundary.Name = "SampleNamedBoundary"; namedBoundary.Save(); break; } } } catch (Exception ex) { Trace.WriteLine(ex.Message); } }